package Java.com.wang.other;

public class TestsequenceList {
    public static void main (String [] arg){
        sequenceList<Integer> L = new sequenceList<Integer>(10);
        sequenceList<Integer> K = new sequenceList<Integer>(10);
        sequenceList<Integer> V = new sequenceList<Integer>(20);
        int i=0,j=0;
        int []a ={3,5,7,11,15};
        int []b={2,6,8,10};
        for (i=0;i<a.length;i++){
            L.add(a[i],i+1);
        }
        for (i=0;i<b.length;i++) {
            K.add(b[i], i + 1);
        }
        System.out.println("顺序表a中的数据元素为：");
        L.nextOrder();
        System.out.println("顺序表b中的数据元素为：");
        K.nextOrder();
        System.out.println("开始顺序表链接");
         for (i=0;i<L.size();i++){
             V.add(L.value(i+1),i+1);
             j=i;
         }
        for (j=i,i=0;i<K.size();i++,j++){
            V.add(K.value(i+1),i+1);
        }
        System.out.println("链接完成的顺序表是：");
        V.nextOrder();
        int m=1;
        System.out.println("V的长度为："+V.size());
        while(m==1) {
            m=0;
            for (i = 0; i <V.size()-1; i++) {
                //System.out.println("开始排序");
                if (V.value(i+1) > V.value(i + 2)) {
                    m = 1;
                    int tmp = V.value(i+1 );
                    V.modify(V.value(i + 2), i+1);
                    V.modify(tmp, i + 2);
                }
            }
        }
        System.out.println("排序后的顺序表是：");
        V.nextOrder();
        System.out.println("OVER");
    }
}
